/**
 * File Comment: edit everything!
 */
package edu.gatech.oad.project.operations.data;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

import edu.gatech.oad.project.coordinator.Office;

/**
 * Java representation of doctors orders. This simply holds
 * data.
 * 
 * @author Group 17
 * @version 1.0
 */
public class DoctorOrders implements Serializable{

    /**
     * 
     */
    private static final long serialVersionUID = -4280302661173189844L;

    /**
     * Field prescription: list of prescribed
     * drugs for the patient
     */
    private List<String> prescription;
    
    /**
     * Field labWork: all the medical work
     * performed by the lab for the patient
     */
    private List<String> labWorkPerformed;
    
    /**
     * Field instructions: list of things the 
     * patient should do after the appointment
     */
    private List<String> instructions;
    
    /**
     * Field myLogger: holds the logget for the office file
     */
    private static final Logger MYLOGGER = Logger.getLogger("edu.gatech." +
            "oad.project.operations.data");
	
    /**
	 * Default constructor that simply initializes
	 * the multiple lists
	 */
	public DoctorOrders() {
		this.prescription = new ArrayList<String>();
		this.labWorkPerformed = new ArrayList<String>();
		this.instructions = new ArrayList<String>();
		
        MYLOGGER.addHandler(Office.FILEHANDLER);
        MYLOGGER.setLevel(Level.ALL);
        MYLOGGER.finest("doctors orders created");
	}

    /**
     * Takes in a doctors orders object and
     * copies over new fields to the actual
     * orders data. NewOrders is just a temp
     * structure to easily pass multiple pieces
     * of data.
     *
     * @param newOrders updated orders
     */
    public void update(DoctorOrders newOrders) {
        List<String> tempStrList;
        
        tempStrList = newOrders.getPrescription();
        if (!tempStrList.isEmpty()){
            this.prescription = tempStrList;
            MYLOGGER.info("updates prescription");
        }
        
        tempStrList = newOrders.getLabWorkPerformed();
        if (!tempStrList.isEmpty()){
            this.labWorkPerformed = tempStrList;
            MYLOGGER.info("updates lab work");
        }
        
        tempStrList = newOrders.getInstructions();
        if (!tempStrList.isEmpty()){
            this.instructions = tempStrList;
            MYLOGGER.info("updates instructions to:");
        }
        
    }

    /**
     * @return the prescription
     */
    public List<String> getPrescription() {
        return prescription;
    }

    /**
     * @param prescription the prescription to set
     */
    public void setPrescription(List<String> prescription) {
        this.prescription = prescription;
    }
    
    /**
     * @return the labWorkPerformed
     */
    public List<String> getLabWorkPerformed() {
        return labWorkPerformed;
    }

    /**
     * @param labWorkPerformed the labWorkPerformed to set
     */
    public void setLabWorkPerformed(List<String> labWorkPerformed) {
        this.labWorkPerformed = labWorkPerformed;
    }

    /**
     * @return the instructions
     */
    public List<String> getInstructions() {
        return instructions;
    }

    /**
     * @param instructions the instructions to set
     */
    public void setInstructions(List<String> instructions) {
        this.instructions = instructions;
    }

    /**
     * String representation of doctor's orders
     * 
     * @return the string representation
     */
    @Override
    public String toString() {
        return "DoctorOrders [prescription=" + prescription
                + ", labWorkPerformed=" + labWorkPerformed + ", instructions="
                + instructions + "]";
    }

    
}
